package com.itheima.controller;

import com.itheima.domain.mongo.Video;
import com.itheima.service.mongo.VideoService;
import com.itheima.vo.PageBeanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/video")
public class VideoController{

    @Autowired
    private VideoService videoService;

    @GetMapping("/findVideo")
    public PageBeanVo findVideo(Long userId, Integer pageNum, Integer pageSize) {
        return videoService.findVideo(userId, pageNum, pageSize);
    }

    @PostMapping("/saveVideo")
    public void saveVideo(Video video) {
        videoService.saveVideo(video);
    }

    @GetMapping("/findUserVideoList")
    public PageBeanVo findUserVideoList(Long uid, Integer pageNum, Integer pageSize) {
        return videoService.findUserVideoList(uid, pageNum, pageSize);
    }
}
